<!DOCTYPE html>
<html lang="ch" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" th:href="@{/lib/layui-v2.6.3/css/layui.css}" media="all">
  <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
  <style>
    body {
      background-color: #ffffff;
    }
  </style>
</head>
<body>
<fieldset class="table-search-fieldset">
        <legend>编辑Product</legend>
      <form class="layui-form layui-form-pane" th:action="@{'/categories/'+${categoryId}+'/products/'+${productId}}" method="post" enctype="multipart/form-data">
        <!--使用隐藏域-->
        <input type="hidden" name="_method" value="put">
        <div class="layui-form layuimini-form" >
          <div class="layui-form-item">
            <label class="layui-form-label required">ID</label>
            <div class="layui-input-block">
              <input type="text" name="productId" readonly="readonly" th:value="${product.productId}" class="layui-input">
              <tip>不能修改商品ID。</tip>
            </div>
          </div>

          <div class="layui-form-item">
            <label class="layui-form-label required">名称</label>
            <div class="layui-input-block">
              <input type="text" name="name" th:value="${product.name}" lay-verify="required" lay-reqtext="商品类型名不能为空" class="layui-input">
              <tip>修改商品类型名。</tip>
            </div>
          </div>

          <!--    图片上传-->
          <div class="layui-form-item">
            <label class="layui-form-label required">图片</label>
            <div class="layui-input-block">
              <img th:src="@{'data:image/png;base64,'+${product.descn}}" id="descnImg" height="90" width="160">
              <input type="file" id="chooseImage" name="file">
            </div>
          </div>

          <!--    图片上传-->

          <div class="layui-form-item">
            <div class="layui-input-block">
              <button type="submit" class="layui-btn layui-btn-normal">确认保存</button>
              <a th:href="@{'/categories/'+${categoryId}+'/products'}" type="submit" class="layui-btn layui-btn-normal">取 消</a>
            </div>
          </div>
        </div>
      </form>
</fieldset>

<script src="/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/lib/jquery-3.4.1/jquery-3.4.1.min.js"> </script>
<script src="/js/chooseImg.js" charset="utf-8"> </script>
</body>
</html>